<template>
  <el-dialog title="添加角色" :close-on-click-modal="false" :visible.sync="iseditRoleDialog2">
    <el-form :model="role" ref="editForm" label-width="80px">
        <el-form-item label="角色名" prop="name">
        <el-input v-model="role.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="备注">
            <el-input type="textarea" v-model="role.remark"></el-input>
        </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
        <el-button @click="iseditRoleDialog2 = false">取 消</el-button>
        <el-button type="primary" @click="submitEdit">确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
    data(){
        return{
            role:{
                name:'',
                remark:''
            },
            iseditRoleDialog2 : false
        }
    },
    methods:{
        submitEdit(){
            this.$http.post('/role',this.role).then(res =>{
                if(res.data.code ==0){
                    this.$message({
                    type: 'success',
                    message: '添加成功!',
                    });
                    this.iseditRoleDialog2 = false
                    this.$emit('refresh')
                }else{
                    this.$message.error('添加失败');
                }
            })
        }
    }
}
</script>

<style>

</style>